<template>
  <div class="main">
    <p class="title">
      <span>
        {{ title }}
      </span>
      <a href="#">更多 >></a>
    </p>
    <slot name="author"></slot>
      <slot name="MainText" ></slot>
    <div class="swipeImg">
      <div class="swiper-container">
        <div class="swiper-wrapper">
          <div
            class="swiper-slide"
            v-for="(item, index) in MainList"
            :key="index"
          >
            <img :src="item" alt="" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Swiper from "swiper";
import "swiper/css/swiper.css";
export default {
  props: ["title", "MainList"],
  mounted() {
    var swiper = new Swiper(".swiper-container", {
      slidesPerView: 3,
      spaceBetween: 30,
      freeMode: true,
    });
  },
};
</script>

<style scoped lang="less">
.mainText{
  padding: .2rem ;
  text-align: left;
  font-size: .3rem;
  font-weight: 600;
}
.author{
  text-align: left;
  height: .7rem;
  line-height: .7rem;
  padding:0 .2rem ;
  img{
    border-radius: 50%;
    width: 10%;
    float: left;
    margin-right: .3rem;
  }
}
.title {
  overflow: hidden;
  text-align: left;
  padding-top: .2rem;
  span{
    font-weight: 600;
    padding-left: .2rem;
    font-size: .3rem;
  }
  a{
    float: right;
    color: gray;
  }
}
.swipeImg {
  position: relative;
  height: 100%;
}

.main {
  background: #eee;
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #000;
  margin: 0;
  padding: 0;
}

.swiper-container {
  width: 100%;
  height: 100%;
}

.swiper-slide {
  border-radius: 25px;
  height: 3rem;
  width: 5rem !important;
  text-align: center;
  font-size: 0.4rem;
  background: #fff;
    img{
        width: 100%;
        height: 100%;
    }
  /* Center slide text vertically */
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
}
</style>